package com.zengshuai.miniprogrambackend.Mapper;

import com.zengshuai.miniprogrambackend.Entity.Address;
import com.zengshuai.miniprogrambackend.Entity.Employee;
import com.zengshuai.miniprogrambackend.Entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper {
    void saveUserOpenid(@Param("openid") String openid);

    Integer isExisted(@Param("openid") String openid);

    List<Address> getAddress(@Param("openid") String openid);

    void addWxAddress(@Param("openid") String openid, String username, String telnumber, String provincename, String cityname, String countyname, String detailinfo);

    void addnewAddress(String openid, String username, String telnumber, String provincename, String cityname, String countyname, String detailinfo, String isdefault);

    void UpdateAddress(String id, String openid, String username, String telnumber, String provincename, String cityname, String countyname, String detailinfo, String isdefault);

    // 清空默认地址
    void updateisdefault(@Param("openid") String openid);

    void deleteaddress(@Param("id") String id);

    User getUserheadImageurl(@Param("openid") String openid);

    List<User> getuserlist();


    //后台管理
    //分页查询


    //用户
    List<User> getUserlistByLimit(Map<String, Integer> map);

    Integer getuserlistlength();

    //查询用户 by openid
    List<User> cxuserbyopenid(Integer page, Integer pagesize, String openid);


    //员工
    List<Employee> getUserlistByLimit2(Map<String, Integer> map);

    Integer getuserlistlength2();

    List<Employee> cxemployeebyemployeeid(Integer page, Integer pagesize, String employeeid);

    Integer addemployee(String employeeid, String password, String telnumber, String name);

    void deleteEmployee(String id);

    //修改
    Integer updateEmployee(String employeeid, String password, String telnumber, String name, String id);

    Integer employeeidisExisted(String employeeid);


    void deleteService(String serviceid);

    Integer login(String username, String password);
}
